package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLdFs;
import com.huizu.project.service.IProLdFsService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 批改分数设置Controller
 * 
 * @author zhangmx
 * @date 2024-05-25
 */
@RestController
@RequestMapping("/project/proldfs")
public class ProLdFsController extends BaseController
{
    @Autowired
    private IProLdFsService proLdFsService;

    /**
     * 查询批改分数设置列表
     */
    //@PreAuthorize("@ss.hasPermi('project:proldfs:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLdFs proLdFs)
    {
        startPage();
        List<ProLdFs> list = proLdFsService.selectProLdFsList(proLdFs);
        return getDataTable(list);
    }

    /**
     * 导出批改分数设置列表
     */
    @PreAuthorize("@ss.hasPermi('project:proldfs:export')")
    @Log(title = "批改分数设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLdFs proLdFs)
    {
        List<ProLdFs> list = proLdFsService.selectProLdFsList(proLdFs);
        ExcelUtil<ProLdFs> util = new ExcelUtil<ProLdFs>(ProLdFs.class);
        util.exportExcel(response, list, "批改分数设置数据");
    }

    /**
     * 获取批改分数设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:proldfs:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(proLdFsService.selectProLdFsById(id));
    }

    /**
     * 新增批改分数设置
     */
    @PreAuthorize("@ss.hasPermi('project:proldfs:add')")
    @Log(title = "批改分数设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLdFs proLdFs)
    {
        return toAjax(proLdFsService.insertProLdFs(proLdFs));
    }

    /**
     * 修改批改分数设置
     */
    @PreAuthorize("@ss.hasPermi('project:proldfs:edit')")
    @Log(title = "批改分数设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLdFs proLdFs)
    {
        return toAjax(proLdFsService.updateProLdFs(proLdFs));
    }

    /**
     * 删除批改分数设置
     */
    @PreAuthorize("@ss.hasPermi('project:proldfs:remove')")
    @Log(title = "批改分数设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(proLdFsService.deleteProLdFsByIds(ids));
    }
}
